import request from "@/utils/request";
// 获取文章列表数据的函数
export const getArticles = params => request({
    method:'GET',
    url:'/v1_0/articles',
    params,
})
// 获取文章详情的接口
export const getArticleById = id => {
    return request({
      method: 'GET',
      url: `/v1_0/articles/${id}`
    })
  }

  // 收藏文章的接口
  export const addCollect = id => request({
    method: 'POST',
    url: '/v1_0/article/collections',
    data: {
      target: id
    }
  })

  // 封装利用id调取消文章收藏的接口的函数
  export const deleteCollect = id => request({
    method: 'DELETE',
    url: `/v1_0/article/collections/${id}`
  })
  
  
// 封装利用id调点赞文章接口的函数
export const addLike = id => request({
  method: 'POST',
  url: '/v1_0/article/likings',
  data: {
    target: id
  }
})

// 封装利用id调取消文章点赞接口的函数
export const deleteLike = id => request({
  method: 'DELETE',
  url: `/v1_0/article/likings/${id}`
})
